package com.vivachek.protocol.converts



/**
 * @Author: YCB
 * @Time: 2022/9/26 18:41
 * @Email: congbin.yuan@vivachek.com
 * @Description: 设备时间
 *
 */
private const val COMMAND = 68
private const val EXPAND_CODE = 170
private const val LENGTH = 6
internal class DeviceTimeConvert : DataConvert(COMMAND, EXPAND_CODE,LENGTH){

    override fun parse(data: List<Int>,origin:List<Int>) {
        val year = 2000+(data[0])
        val month = String.format("%02d",data[1])
        val day = String.format("%02d",data[2])
        val hour = String.format("%02d",data[3])
        val min = String.format("%02d",data[4])
        val second = String.format("%02d",data[5])
        listener?.deviceTime("$year-$month-$day $hour:$min:$second")
    }
}